<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/WEB-INF/adminui/include/css.jsp" %>
<title>农资管理列表</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-9" style="width:100%;">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div id="toolbar" class="columns pull-left">
							<button type="button" class="btn btn-primary" onclick="add()" uilist-prem="repertory_EDIT">
								<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
							</button>
						</div>
					</div>
					<table id="dataTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/adminui/include/script.jsp" %>
<script type="text/javascript">
$(function(){
	UiList.render({
		treeId:false,
		tableConfig:{
			url: "${path}/repertory/getAccount.json?repertoryid=${repertoryid}",
			idfield: 'accountid',
			columns: [
				{checkbox : true},
				{field : 'type', title : '操作类型',formatter : function(value, row, index) {
					var s = '';
					if(value=='0'){
						s = '新增';
					}else if(value=='1'){
						s = '发放';
					}else{
						s = '回收';
					}
					return s;
				}},
				{field : 'number', title : '数量'},
				{field : 'operate_time', title : '操作时间', formatter : function(value, row, index) {
					return formatDate(value, 'yyyy-MM-dd HH:mm');
				}},
				{field : 'responsible', title : '负责人'},
				{field : 'accountid', title : '操作', align : 'center', formatter : function(value, row, index) {
					var s = '';
					s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="查看" onclick="look(\''+value+'\')">查看</a>';
					return s;
				}}
			]
		}
	});
	
});

function add(){
	UiList.open('${path}/repertory/addAccount.do?repertoryid=${repertoryid}', '添加流水账', {refresh:true});
}
function look(id){
	UiList.open('${path}/repertory/lookAccount.do?repertoryid=${repertoryid}&accountid='+id, '查看流水账', {refresh:true});
}
</script>
</body>
</html>